import App from './App'

import Vue from 'vue'
import './static/fonts/font.css'


import './uni.promisify.adaptor'
// 引入VUEX
import store from './store'
import MinRequest from './utils/MinRequest.js'
// 引入api文件
import minRequest  from './api/index.js'
// 检查网络状态
import $U from './utils/checks.js'

// 时间格式化
import dayjs from './libs/dayjs.min.js'
import "./libs/locale/zh-cn";

// 数值、货币处理工具
import currency from './utils/currency.min.js'

// 加载时间转换插件
import weekOfYear from './libs/plugin/weekOfYear/index.js'
import isoWeeksInYear from './libs/plugin/isoWeeksInYear/index.js'
import isLeapYear from './libs/plugin/isLeapYear/index.js'
import dayOfYear from './libs/plugin/dayOfYear/index.js'
import relativeTime from './libs/plugin/relativeTime/index.js'
import toArray from './libs/plugin/toArray/index.js'
import calendar from './libs/plugin/calendar/index.js'
import isBetween from './libs/plugin/isBetween/index.js'
dayjs.extend(weekOfYear)
dayjs.extend(isoWeeksInYear)
dayjs.extend(isLeapYear)
dayjs.extend(dayOfYear)
dayjs.extend(relativeTime)
dayjs.extend(toArray)
dayjs.extend(calendar)
dayjs.extend(isBetween)
dayjs.locale("zh-cn");

const formatTime = (date, template) => dayjs(date).format(template);
const formatPrice = (price, symbol='￥') => currency(price, { symbol: symbol }).format();
// 时分秒与时间戳相互转化 time: HH:mm:ss
const timeCycle = (time)=> {
	return new Date('1970-01-01' + time).getTime() + 28800000
}

const EventBus = new Vue();

Vue.use(MinRequest)

Vue.prototype.$EventBus = EventBus

Vue.prototype.$dayjs = dayjs
Vue.prototype.$U = $U
Vue.prototype.$formatTime = formatTime
Vue.prototype.$currency = currency
Vue.prototype.$formatPrice = formatPrice
Vue.prototype.$timeCycle = timeCycle

Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
    ...App,
	store,
	minRequest,
})
app.$mount()
